import { Pipe, PipeTransform } from '@angular/core';
import { Observable } from 'rxjs';

@Pipe({ name: 'groupedItemsTransform' })
export class GroupedItemsTransform implements PipeTransform {
    transform(obj: any): Array<{
        key: string;
        value: any
    }> {
        let array = [];
        if (!obj) return [];
        Object.keys(obj).map((key) => {
            array.push({ id: key, name: key, type: "category" });
            array = array.concat(obj[key]);
        });
        return array;
    }
}
